<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%--
    Document   : blank
    Created on : 25.03.2010, 19:33:27
    Author     : Cyclone
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<body>
    <%--<script src="js/jquery.tablesorter.min.js" type="text/javascript"></script>--%>
    <script src="js/courses.js" type="text/javascript"></script>

    <%@include file="systemMessage.jsp" %>

    <div id="box" class="rounded-divcascade">
        <div id="rightnow">
            <h3 class="reallynow">
                <span>
                    Расширение
                </span>
                <!--<a class="app_add" href="#addUser">Добавить пользователя</a>-->
                <br/>
            </h3>
        </div>

        <form id="form" action="ManagePlugin?act=edit" method="post" class="rounded-formcascade">
            <fieldset>
                <legend>Общее</legend>
                <label for="id">ID расширения : </label>
                <input type="text" name="id" readonly="readonly" value="${plugin.idPlugin}">

                <label for="name">Название : </label>
                <input type="text" name="name"
                       tabindex="1" value="${fn:escapeXml(plugin.name)}" />
                <br />

                <label for="enable">Включено : </label>
                <c:choose>
                    <c:when test="${plugin.enable == true}">
                        <input type="checkbox" checked="checked" name="enable" style="width: auto"/>
                    </c:when><c:otherwise>
                        <input type="checkbox" name="enable" style="width: auto"/>
                    </c:otherwise>
                </c:choose>
                <br/>

                <label for="property">Свойство : </label>
                <select name="property">
                    <c:forEach var="property" items="${propertyList}">
                        <c:choose>
                            <c:when test="${plugin.additionalProperty.idAdditionalProperty == property.idAdditionalProperty}">
                                <option selected="selected" value="${property.idAdditionalProperty}">${property.name}</option>
                            </c:when><c:otherwise>
                                <option value="${property.idAdditionalProperty}">${property.name}</option>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>
                </select>


                <label for="initType">Тип запуска : </label>
                <select name="initType">
                    <c:choose>
                        <c:when test="${plugin.initType == 0}">
                            <option value="0" selected="selected">Ссылка</option>
                        </c:when>
                        <c:otherwise>
                            <option value="0">Ссылка</option>
                        </c:otherwise>
                    </c:choose>
                    <c:choose>
                        <c:when test="${plugin.initType == 1}">
                            <option value="1" selected="selected">Скрипт</option>
                        </c:when>
                        <c:otherwise>
                            <option value="1">Скрипт</option>
                        </c:otherwise>
                    </c:choose>
                </select>
                <br/>

                <label for="description">Запуск : </label>
                <textarea name="initiate" tabindex="4" style="height: 50px;">${plugin.initiate}</textarea>
                <br/>

                <br/>
                <label for="description">Описание : </label>
                <c:choose><c:when test="${sessionScope.roles.admin}">
                        <textarea id="textAreaDescription" name="description" tabindex="4" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${plugin.description}</textarea>
                    </c:when><c:otherwise>
                        <textarea id="textAreaDescription" readonly="readonly" tabindex="4" style="height: 50px;" onmouseover="textAreaFocus();" onmouseout="textAreaBlur();">${plugin.description}</textarea>
                    </c:otherwise></c:choose>


                <%--
                                <c:if test="${sessionScope.roles.admin || sessionScope.roles.tutor}">
                                    <p align="center">
                                        <a href="SignStudents?courseId=${course.id}"><input style="width: 33%" type="button" value="Списки студентов"></a>
                                        <c:if test="${sessionScope.roles.admin}">
                                            <a href="SignTutors?courseId=${course.id}"><input  style="width: 33%" type="button" value="Списки тьюторов"></a>
                                            <input  style="width: 33%" type="button" value="Удалить курс" onclick="deleteCourse(${course.id}, event, '${fn:escapeXml(course.title)}');" style="width: 25%;"/>
                                        </c:if>
                                    </p>
                                </c:if>
                --%>
            </fieldset>


            <div align="center">
                <c:if test="${sessionScope.roles.admin}">
                    <input type="submit" tabindex="20" value="Сохранить" style="width: 205px;" />
                    <input type="reset" tabindex="21" value="Отменить" style="width: 205px;" />
                    <input type="button" tabindex="22" value="Удалить" id="delete" style="width: 205px; text-align: center"
                           onclick="if(confirm('Вы действительно хотите удалить расширение?')){window.location = 'ManagePlugin?act=delete&id=${plugin.idPlugin}';}"/>
                    <br />
                </c:if>

            </div>

        </form>
    </div>

    <script type="text/javascript">
        $(document).ready(function(){
            $("#liConfig").addClass("current");
            $('div#top-panel p').text('Редактирование расширения');

            try {
                if('${param.new}' != '') {
                    
                    $('form#form').attr('action', 'ManagePlugin?act=add');
                    $('input#delete').remove();
                    $('label[for=id]').remove();
                    $('input#[name=id]').remove();
                    $('div#top-panel p').text('Добавление расширения');
                }
            } catch(e) {}
        });
    </script>

</body>

